<?php
class Sunnet_Filter_CovertMoneyView {
	public function filterInt($str) {
		$len = strlen($str);
		$dem = ceil($len / 3);
		$number ='';
		if(($len % 3)==1){
			
				$strtop = substr($str,0,1);
				$strmain = substr($str,1);
				$str = $strmain;
				$number .= $strtop;
				for($i=0;$i<$dem-1;$i++){
					$strend = substr($str,0,3);
					$strmain = substr($str,3);
					$str = $strmain;
					if($i != $len-1) $number .= '.'.$strend;
					
				}
		}
		if(($len % 3)==2){
			
				$strtop = substr($str,0,2);
				$strmain = substr($str,2);
				$str = $strmain;
				$number .= $strtop;
				for($i=0;$i<$dem-1;$i++){
					$strend = substr($str,0,3);
					$strmain = substr($str,3);
					$str = $strmain;
					if($i != $len-1) $number .= '.'.$strend;
					
				}
		}
		if(($len % 3)==0){
			
				$strtop = substr($str,0,3);
				$strmain = substr($str,3);
				$str = $strmain;
				$number .= $strtop;
				for($i=0;$i<$dem-1;$i++){
					$strend = substr($str,0,3);
					$strmain = substr($str,3);
					$str = $strmain;
					if($i != $len-1) $number .= '.'.$strend;
					
				}
		}
		return $number;
	}
}
?>